Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
I'm wanting to make customfield3 into a dropdown which states:

Code
Select
------
Male
Female
and i want it to require users to select one or the other (using values i know, but making the form is what i'm having issues with since i viewed presant options).

I'd also like to have it so that it's required as well in the followign areas:
cp edit profile (cp_edit_profile.pl)
public edit profile (public_edit_profile.pl)
registrations (public_register_form.pl)

note that the file names canbe off a bit since i'm running on 0 sleep...

Any help would be greatly appreciated.


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Sponsored Links
Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
Ok, so far I have:

Replace:
Code
input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
With:
Code
<select name="customfield3">
<option>$vars_wordlets_mods{gender_select}</option>
<option>$vars_wordlets_mods{gender_selector}</option>
<option value="Male">$vars_wordlets_mods{gender_male}</option>
<option value="Female">$vars_wordlets_mods{gender_female}</option>
</select></select>
Which sets the profile field to male or female, BUT, how would i go about making it have one selected when viewed in edit profile lol, it just shows "select"


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
try using...

Code
if($user_profile[16] eq 'Male') {
my $maleselect = qq! selected="selected"!;
} else {
my $maleselect = qq! !;
}

if($user_profile[16] eq 'Female') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}

if($user_profile[16] eq '') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}

<select name="customfield3">
<option>$vars_wordlets_mods{gender_select}</option>
<option>$vars_wordlets_mods{gender_selector}</option>
<option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
<option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>
(note: I made it default to female to avoid being a chauvenist pig. gotta love the times we live in frown )

Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
where do i put the if/else statements?


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
oh, and you could have made "select" the default statement :x...


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
FIND:
=====
Code
<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
REPLACE WITH:
==============
Code
if($user_profile[18] eq 'Male') {
my $maleselect = qq! selected="selected"!;
} else {
my $maleselect = qq! !;
}

if($user_profile[18] eq 'Female') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}

if($user_profile[18] eq '') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}

<select name="customfield3">
<option>$vars_wordlets_mods{gender_select}</option>
<option>$vars_wordlets_mods{gender_selector}</option>
<option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
<option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
new gameplan, now that I looked at the file shocked

FIND:
=====
Code
if (($vars_registration{custom4_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

if ($vars_registration{custom3_field_use} eq 'REQ') {
$B1 = '<b>';
$B2 = '</b>';
} else {
$B1 = '';
$B2 = '';
}
ADD AFTER:
==========
Code
if($user_profile[18] eq 'Male') {
my $maleselect = qq! selected="selected"!;
} else {
my $maleselect = qq! !;
}

if($user_profile[18] eq 'Female') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}

if($user_profile[18] eq '') {
my $femaleselect = qq! selected="selected"!;
} else {
my $femaleselect = qq! !;
}
THEN FIND:
==========
Code
<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />
AND REPLACE IT WITH:
====================
Code
<select name="customfield3">
<option>$vars_wordlets_mods{gender_select}</option>
<option>$vars_wordlets_mods{gender_selector}</option>
<option value="Male" $maleselect>$vars_wordlets_mods{gender_male}</option>
<option value="Female" $femaleselect>$vars_wordlets_mods{gender_female}</option>
</select>
try that

Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
just shows dropdown, doesn't select users...

u. test
p. tester
url: http://www.undergroundnews.com/cgi-bin/ubbcgi/ultimatebb.cgi?ubb=edit_my_profile


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
ratio buttons, dropdown, so long as it works :x...


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
:bump:


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Sponsored Links
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
ok, here we go.

Code
in public_edit_profile.pl

find:
<input type="text" name="customfield2" value="$user_profile[17]" size="35" maxlength="80" />
</td>
</tr>

THISFIELD

} # end field

add after:

if($user_profile[18] eq 'Female') {
$male_yes = '';
$male_no = qq( checked="checked");
} else {
$male_no = '';
$male_yes = qq( checked="checked");
}

find:

<input type="text" name="customfield3" value="$user_profile[18]" size="35" maxlength="80" />

replace with:

<input type="radio" name="customfield3" value="Male" $male_yes /> $vars_wordlets_mods{male_option}

<input type="radio" name="customfield3" value="Female" $male_no /> $vars_wordlets_mods{female_option}

Also, just for cosmetic purposes...

find:

<td>
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$B1$vars_registration{customfield3}$B2:

replace with:

<td valign="top">
<font size="$vars_style{TextSize}" face="$vars_style{FontFace}">
$B1$vars_registration{customfield3}$B2:

in vars_wordlets_mods.cgi

find:
%vars_wordlets_mods = (

add after:

q!female_option! => q!Female!,
q!male_option! => q!Male!,
that should do it. It defaults to Male.

Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
ok, you just asked for public_register_form.pl so here

Code
find:
$vars_registration{customfield3}, "", "customfield3", "text", 35, 80, 0);

replace with:

$vars_registration{customfield3}, "", "customfield3", "radio", { Male => $vars_wordlets_mods{male_option}, Female => $vars_wordlets_mods{female_option} }, [qw(Male Female)], Male);

Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
Sweet, with adding that in, and tweaking the positioning of custom3, i have a very nice outlook smile ... Thanks al wink ...


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
you can try this for the cp.

Code
in cp_edit_profile.pl
find:
if (($vars_registration{custom3_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

if ($vars_registration{custom3_field_use} eq 'REQ') {
$B1 = '<b>';
$B2 = '</b>';
} else {
$B1 = '';
$B2 = '';
}

&AlternateColors;

print <<THISFIELD;

<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title" style="font-weight: normal;">
$B1$vars_registration{customfield3}$B2:
</td><td class="autorow"><span class="autorow-options">
<INPUT TYPE="TEXT" NAME="customfield3" value="$user_profile[18]" SIZE="35" MAXLENGTH="80">
</span></td>
</tr>
THISFIELD

} # end field

replace with:

if($user_profile[18] eq 'Female') {
$male_yes = '';
$male_no = qq( checked="checked");
} else {
$male_no = '';
$male_yes = qq( checked="checked");
}

if (($vars_registration{custom3_field_use} ne 'DEL') && ($vars_registration{customfield3} ne '')) {

if ($vars_registration{custom3_field_use} eq 'REQ') {
$B1 = '<b>';
$B2 = '</b>';
} else {
$B1 = '';
$B2 = '';
}

&AlternateColors;

print <<THISFIELD;

<tr bgcolor="$vars_style_cp{AltColumnColorCurrent}">
<td class="autorow"><span class="autorow-title" style="font-weight: normal;">
$B1$vars_registration{customfield3}$B2:
</td><td class="autorow"><span class="autorow-options">
<input type="radio" name="customfield3" value="Male" $male_yes /> $vars_wordlets_mods{male_option}

<input type="radio" name="customfield3" value="Female" $male_no /> $vars_wordlets_mods{female_option}
</span></td>
</tr>
THISFIELD

} # end field
smile

Joined: Jan 2000
Posts: 5,834
Likes: 20
UBBDev Owner
Time Lord
UBBDev Owner
Time Lord
Joined: Jan 2000
Posts: 5,834
Likes: 20
Hey al, how about that cp mod for 6.6.1?


UBBDev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.threads: My UBB Themes, My UBB Scripts
Joined: Jan 2003
Posts: 3,456
Likes: 2
Master Hacker
Master Hacker
Offline
Joined: Jan 2003
Posts: 3,456
Likes: 2
I'll look into it like Fridayish. I've got 2 essays to write frown


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 253
Joined: January 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 413
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 21
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)